import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param numbers int整型一维数组 
     * @return int整型
     */
    public int MoreThanHalfNum_Solution (int[] numbers) {
        // write code here
        HashMap<Integer,Integer> hashMap = new HashMap<>();
        for(int i = 0;i<numbers.length;i++) {
            if(hashMap.containsKey(numbers[i])) {
                hashMap.put(numbers[i],hashMap.get(numbers[i]) + 1); 
                if(hashMap.get(numbers[i]) > (numbers.length/2))
                {
                    return numbers[i];
                }
            }else {
                hashMap.put(numbers[i],1);
            }
        }
        return numbers[0];
    }
}